<%@ page import="com.informet.ipd.modelo.dao.FisiMetaDao" %>
<%@ page import="com.informet.ipd.modelo.vo.FisiMetaVO" %>
<%@ page import="com.informet.ipd.modelo.vo.FisiMetaMVO" %>
<%@ page import="com.informet.ipd.struts.form.PEIForm" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.swing.JOptionPane"%>
<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/tags/c" prefix="c"%>

<%
            StringBuffer cadenaSalida = new StringBuffer();
            List lista = null;
            int tFMe = Integer.parseInt(request.getParameter("tFMe"));
            FisiMetaDao supportFacade = new FisiMetaDao();
            PEIForm form1 = new PEIForm();
            FisiMetaVO oFMe = null;
            try {
            int codMA = Integer.parseInt(request.getParameter("codMA"));
            int codFM = Integer.parseInt(request.getParameter("codFM"));
            int tipo = Integer.parseInt(request.getParameter("tipo"));
            Double mes1 = Double.parseDouble(request.getParameter("mes1"));
            Double mes2 = Double.parseDouble(request.getParameter("mes2"));
            Double mes3 = Double.parseDouble(request.getParameter("mes3"));
            Double mes4 = Double.parseDouble(request.getParameter("mes4"));
            Double mes5 = Double.parseDouble(request.getParameter("mes5"));
            Double mes6 = Double.parseDouble(request.getParameter("mes6"));
            Double mes7 = Double.parseDouble(request.getParameter("mes7"));
            Double mes8 = Double.parseDouble(request.getParameter("mes8"));
            Double mes9 = Double.parseDouble(request.getParameter("mes9"));
            Double mes10 = Double.parseDouble(request.getParameter("mes10"));
            Double mes11 = Double.parseDouble(request.getParameter("mes11"));
            Double mes12 = Double.parseDouble(request.getParameter("mes12"));
                
                
                
                    oFMe = new FisiMetaVO(codFM,codMA,tFMe,mes1,mes2,mes3,mes4,mes5,mes6,mes7,mes8,mes9,mes10,mes11,mes12);
                    supportFacade.spMan(tipo, oFMe);
                
            
                lista = supportFacade.getFiltro(codMA);
               
                form1.setListaFisiMeta(lista);
               

                
                cadenaSalida.append("<table id='tabla1' width='99%' align='right' class='userTable'>");
                cadenaSalida.append("<tr class='even' align='center'>");
                cadenaSalida.append("<th class='textoTR'>#</th> ");                
                cadenaSalida.append("<th class='textoTR'>Meta</th> ");
                cadenaSalida.append("<th class='textoTR'>Total</th> ");     
                cadenaSalida.append("<th class='textoTR'>Ene</th> ");
                cadenaSalida.append("<th class='textoTR'>Feb</th> ");
                cadenaSalida.append("<th class='textoTR'>Mar</th> ");
                cadenaSalida.append("<th class='textoTR'>Abr</th> ");
                cadenaSalida.append("<th class='textoTR'>May</th> ");
                cadenaSalida.append("<th class='textoTR'>Jun</th> ");
                cadenaSalida.append("<th class='textoTR'>Jul</th> ");
                cadenaSalida.append("<th class='textoTR'>Ago</th> ");
                cadenaSalida.append("<th class='textoTR'>Set</th> ");
                cadenaSalida.append("<th class='textoTR'>Oct</th> ");
                cadenaSalida.append("<th class='textoTR'>Nov</th> ");
                cadenaSalida.append("<th class='textoTR'>Dic</th> ");
                cadenaSalida.append("<th class='textoTR'>Editar</th>");
                cadenaSalida.append("<th class='textoTR'>Eliminar</th> ");
                cadenaSalida.append("</tr>");
                  int i=1;
                Iterator it = lista.iterator();
                while (it.hasNext()) {
                    oFMe = (FisiMetaVO) it.next();
                    cadenaSalida.append("<tr align='center'> ");
                            cadenaSalida.append("<td width='10%' align='center'>" +i++ + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getStringTipoFisiMeta() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getMayor() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES1FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES2FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES3FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES4FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES5FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES6FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES7FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES8FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES9FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES10FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES11FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES12FISIMETA() + "</td>");
                            cadenaSalida.append("<td width='10%' align='center'>");
                            cadenaSalida.append("<img style='cursor:pointer' title='Editar' alt='Editar' border=0  src='images/b_edit.png' onclick=\"editarT('"+oFMe.getNUM_CODMETAAPER_PK()+"','"+oFMe.getTX_TIPOFISIMETA()+"','"+oFMe.getNUM_MES1FISIMETA()+"','"+oFMe.getNUM_MES2FISIMETA()+"','"+oFMe.getNUM_MES3FISIMETA()+"','"+oFMe.getNUM_MES4FISIMETA()+"','"+oFMe.getNUM_MES5FISIMETA()+"','"+oFMe.getNUM_MES6FISIMETA()+"','"+oFMe.getNUM_MES7FISIMETA()+"','"+oFMe.getNUM_MES8FISIMETA()+"','"+oFMe.getNUM_MES9FISIMETA()+"','"+oFMe.getNUM_MES10FISIMETA()+"','"+oFMe.getNUM_MES11FISIMETA()+"','"+oFMe.getNUM_MES12FISIMETA()+"','"+oFMe.getNUM_CODFISIMETA_PK()+"');activar()\">");
                            cadenaSalida.append("</td>");
                            cadenaSalida.append("<td width='10%' align='center'> ");
                            cadenaSalida.append("<img style='cursor:pointer' title='Eliminar' alt='Eliminar' border=0  src='images/b_drop.png' onclick=\"eliminar('"+oFMe.getNUM_CODFISIMETA_PK()+"','"+oFMe.getNUM_CODMETAAPER_PK()+"');activar()\" >");
                            cadenaSalida.append("</td>");
                    cadenaSalida.append("</tr>");

                }
                    cadenaSalida.append("</table>");

                    /*<tr>
                                              <td>
                                              <html:button property="button"  value="regresar" onclick="javascript: window.history. back()" />
                                              </td>
                                          </tr>*/


                //JOptionPane.showMessageDialog(null,"chau lisatrmetafisicaajax");
            } catch (Exception e) {
                 cadenaSalida.append("error : "+e.toString());
            }
            out.print(cadenaSalida);
%>